from django.db import migrations, models

class Migration(migrations.Migration):
    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name='ProvincePatent',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('province', models.CharField(max_length=50, verbose_name='省份')),
                ('count', models.IntegerField(verbose_name='专利数量')),
            ],
            options={
                'db_table': 'province_patents',
                'verbose_name': '省份专利数据',
                'verbose_name_plural': '省份专利数据',
            },
        ),
        
        migrations.CreateModel(
            name='Keyword',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('keyword', models.CharField(max_length=100, unique=True, verbose_name='核心词')),
                ('count', models.IntegerField(verbose_name='出现次数')),
            ],
            options={
                'db_table': 'keywords',
                'verbose_name': '核心词',
                'verbose_name_plural': '核心词',
            },
        ),
        
        migrations.CreateModel(
            name='WordPair',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('kword1', models.ForeignKey(
                    'Keyword',
                    on_delete=models.CASCADE,
                    related_name='pairs_as_first',
                    verbose_name='核心词1'
                )),
                ('kword2', models.ForeignKey(
                    'Keyword',
                    on_delete=models.CASCADE,
                    related_name='pairs_as_second',
                    verbose_name='核心词2'
                )),
                ('co_count', models.IntegerField(verbose_name='共现次数')),
            ],
            options={
                'db_table': 'word_pairs',
                'verbose_name': '词对关系',
                'verbose_name_plural': '词对关系',
                'unique_together': [('kword1', 'kword2')],
            },
        ),
        
        migrations.CreateModel(
            name='TopOrg',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('org', models.CharField(max_length=200, unique=True, verbose_name='机构名称')),
                ('count', models.IntegerField(verbose_name='专利数量')),
            ],
            options={
                'db_table': 'top_orgs',
                'verbose_name': '机构专利排名',
                'verbose_name_plural': '机构专利排名',
                'ordering': ['-count'],
            },
        ),
        
        migrations.AddIndex(
            model_name='WordPair',
            index=models.Index(fields=['kword1', 'kword2'], name='word_pairs_kwords_idx'),
        ),
        migrations.AddIndex(
            model_name='WordPair',
            index=models.Index(fields=['co_count'], name='word_pairs_count_idx'),
        ),
        
        migrations.CreateModel(
            name='WordTrend',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('year', models.IntegerField(verbose_name='年份')),
                ('word', models.CharField(max_length=100, verbose_name='核心词')),
                ('patent_count', models.IntegerField(verbose_name='专利数量')),
                ('count', models.IntegerField(verbose_name='词出现数量')),
            ],
            options={
                'db_table': 'word_trends',
                'verbose_name': '核心词趋势',
                'verbose_name_plural': '核心词趋势',
                'unique_together': [('year', 'word')],
                'indexes': [
                    models.Index(fields=['year', 'word'], name='word_trends_year_word_idx'),
                    models.Index(fields=['word'], name='word_trends_word_idx'),
                ],
            },
        ),
    ] 